﻿using System;

namespace RestAPI
{
    #region 回调类型枚举

    public enum CallBackService
    {
        confcallback,
        deleteCalled,
        addCalled,
        setBigView,
        updateVideoStream,
        overConF,
    }

    #endregion

    public class CallBackBase
    {
        private bool isRunning = false;

        public CallBackService callBackService;

        public RestAPIModelBase model;

        public bool isStop = false;

        public bool IsRunning
        {
            get
            {
                if (isRunning)
                    Console.WriteLine(callBackService.ToString() + " is running.");
                return isRunning;
            }
            set { isRunning = value; }
        }

        public delegate void CallBackHandler(string data);

        public CallBackBase(CallBackService cbService, RestAPIModelBase _model)
        {
            callBackService = cbService;
            model = _model;
        }

        public void Stop()
        {
            if (isStop)
                return;
            isStop = true;
            Console.WriteLine("Stopping CallBack.");
        }
    }
}
